package com.example.text2.controller;

import com.example.text2.pojo.Coustomer;
import com.example.text2.service.CoustmerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@CrossOrigin
@RestController
public class CoustmerController {
    @Autowired
    private CoustmerService coustmerService;

    @RequestMapping("/findById")
    public Coustomer fingById(Integer id){
        return  coustmerService.findById(id);
    }
    @RequestMapping ("/getAll")
    public List<Coustomer> findAll(){
        return  coustmerService.findAll();

    }
    @GetMapping("/search")
    public List<Coustomer> search(Coustomer coustomer){
        return  coustmerService.search(coustomer);

    }
}
